//
//  BaseTabBarController.m
//  WXMusic
//
//  Created by 漫步人生路 on 15/8/31.
//  Copyright (c) 2015年 漫步人生路. All rights reserved.
//

#import "BaseTabBarController.h"
#import "MainMusicTableViewController.h"
#import "TopListMusicTableViewController.h"
#import "ClassificationMusicViewController.h"
#import "MyMusicViewController.h"

@interface BaseTabBarController ()

@end

@implementation BaseTabBarController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.tabBar.tintColor = [UIColor redColor];
    self.tabBar.barTintColor = [UIColor blackColor];
    MainMusicTableViewController *mainMusicVC = [[MainMusicTableViewController alloc]initWithStyle:UITableViewStylePlain];
    TopListMusicTableViewController *topListMusicVC = [[TopListMusicTableViewController alloc]initWithStyle:UITableViewStylePlain];
    ClassificationMusicViewController *classificationMusicVC = [[ClassificationMusicViewController alloc]init];
    MyMusicViewController *myMusicVC = [[MyMusicViewController alloc]init];
    [self addChildVC:mainMusicVC title:@"首页" imageName:@"cm2_note_icn_listen" selectedImage:@""];
    [self addChildVC:topListMusicVC title:@"排行榜" imageName:@"cm2_note_icn_logo" selectedImage:@""];
    [self addChildVC:classificationMusicVC title:@"分类" imageName:@"cm2_btm_icn_music_prs" selectedImage:@""];
    [self addChildVC:myMusicVC title:@"我的" imageName:@"ic_radiopage_personal" selectedImage:@""];
}

- (void)addChildVC:(UIViewController *)childVC title:(NSString *)title imageName:(NSString *)imageName selectedImage:(NSString *)selectedImage
{
    新东方的现货价格放得开回家;立刻回家了健康;考虑考虑;\
    //设置默认图标
    childVC.tabBarItem.image = [UIImage imageNamed:imageName];
    //设置选中图标
    childVC.tabBarItem.selectedImage = [[UIImage imageNamed:selectedImage] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    //设置导航控制器
    UINavigationController *childNVC = [[UINavigationController alloc]initWithRootViewController:childVC];
    childNVC.tabBarItem.title = title;
    childNVC.navigationBar.barTintColor = [UIColor blackColor];
    //将我们设置好的视图控制器添加至TabbarController
    [self addChildViewController:childNVC];
    
}








- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
